# -*- coding: utf-8 -*-
'''
Created on 2013-5-12

@author: yq
'''
from Common.htmlHlep import Find
from Common.tool import tool
from Cms import config
from Cms.plus import  page,user
from Models import  models
import  hashlib,datetime,random
from django.db import transaction

@page.page_render(user.Admin())
def AddNews(request):
        info=models.Article_Content()
        return Find.View(request,info)
    
@page.page_render(user.Admin())
@transaction.commit_manually 
def DoAddNews(request):
    try:
        
        transaction.commit()
    except Exception:
        transaction.rollback()
        
    return Find.JsonX(False, "操作成功")
    
    
@page.page_render(user.Admin())
def EditNews(request):
        info=models.Article_Content()
        return Find.View(request,info)
    
@page.page_render(user.Admin())
@transaction.commit_manually 
def DoEditNews(request):
    try:
        
        transaction.commit()
    except Exception:
        transaction.rollback()
        
    return Find.JsonX(False, "操作成功")